package com.itheima.vo;

import cn.hutool.core.bean.BeanUtil;
import com.itheima.domain.db.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SoundVo {

    private Integer id; //动态id

    private Long userId; //用户id
    private String avatar; //头像
    private String nickname; //昵称
    private String gender; //性别 man woman
    private Integer age; //年龄
    private String[] tags; //标签

    private String soundUrl;//语音地址

    private Integer remainingTimes; // 次数

    // 设置用户信息
    public void setUserInfo(UserInfo userInfo) {
        if (userInfo != null) {
            BeanUtil.copyProperties(userInfo, this);
            if (userInfo.getTags() != null) {
                this.setTags(userInfo.getTags().split(","));
            }
            this.setUserId(userInfo.getId());
        }
    }

    /*// 设置语音信息
    public void setSound(Sound sound) {
        // 设置动态信息
        BeanUtil.copyProperties(sound, this);
        // 设置语音url
        this.setSoundUrl(sound.getSoundUrl());
        //设置语音次数
        this.setRemainingTimes(sound.getRemaining());
    }*/
}


